'\" te
.\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PAM_SM_AUTHENTICATE 3PAM "August 19, 2023"
.SH NAME
pam_sm_authenticate \- service provider implementation for pam_authenticate
.SH SYNOPSIS
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lpam\fR [ \fIlibrary\fR... ]
#include <security/pam_appl.h>
#include <security/pam_modules.h>


\fBint\fR \fBpam_sm_authenticate\fR(\fBpam_handle_t *\fR\fIpamh\fR, \fBint\fR \fIflags\fR,
     \fBint\fR \fIargc\fR, \fBconst char **\fR\fIargv\fR);
.fi

.SH DESCRIPTION
In response to a call to \fBpam_authenticate\fR(3PAM), the  \fBPAM\fR framework
calls \fBpam_sm_authenticate()\fR from the modules listed in the
\fBpam.conf\fR(5) file. The authentication provider supplies the back-end
functionality for this interface function.
.sp
.LP
The \fBpam_sm_authenticate()\fR function is called to verify the identity of
the current user. The user is usually required to enter a password or similar
authentication token depending upon the authentication scheme configured within
the system. The user in question is specified by a prior call to
\fBpam_start()\fR, and is referenced by the authentication handle \fIpamh\fR.
.sp
.LP
If the user is unknown to the authentication service, the service module should
mask this error and continue to prompt the user for a password. It should then
return the error, \fBPAM_USER_UNKNOWN\fR.
.sp
.LP
The following flags may be passed in to \fBpam_sm_authenticate()\fR:
.sp
.ne 2
.na
\fB\fBPAM_SILENT\fR\fR
.ad
.RS 29n
The authentication service should not generate any messages.
.RE

.sp
.ne 2
.na
\fB\fBPAM_DISALLOW_NULL_AUTHTOK\fR\fR
.ad
.RS 29n
The authentication service should return
.RE

.sp
.ne 2
.na
\fB\fBPAM_AUTH_ERR\fR\fR
.ad
.RS 29n
The user has a null authentication token.
.RE

.sp
.LP
The \fIargc\fR argument represents the number of module options passed in from
the configuration file \fBpam.conf\fR(5). \fIargv\fR specifies the module
options, which are interpreted and processed by the authentication service.
Please refer to the specific module man pages for the various available
\fIoptions\fR. If any unknown option is passed in, the module should log the
error and ignore the option.
.sp
.LP
Before returning, \fBpam_sm_authenticate()\fR should call \fBpam_get_item()\fR
and retrieve \fBPAM_AUTHTOK\fR. If it has not been set before and the value is
\fINULL\fR, \fBpam_sm_authenticate()\fR should set it to the password entered
by the user using \fBpam_set_item()\fR.
.sp
.LP
An authentication module may save the authentication status (success or reason
for failure) as state in the authentication handle using
\fBpam_set_data\fR(3PAM). This information is intended for use by
\fBpam_setcred()\fR.
.SH RETURN VALUES
Upon successful completion,  \fBPAM_SUCCESS\fR must be returned. In addition,
the following values may be returned:
.sp
.ne 2
.na
\fB\fBPAM_MAXTRIES\fR\fR
.ad
.RS 25n
Maximum number of authentication attempts exceeded.
.RE

.sp
.ne 2
.na
\fB\fBPAM_AUTH_ERR\fR\fR
.ad
.RS 25n
Authentication failure.
.RE

.sp
.ne 2
.na
\fB\fBPAM_CRED_INSUFFICIENT\fR\fR
.ad
.RS 25n
Cannot access authentication data due to insufficient credentials.
.RE

.sp
.ne 2
.na
\fB\fBPAM_AUTHINFO_UNAVAIL\fR\fR
.ad
.RS 25n
Underlying authentication service can not retrieve authentication information.
.RE

.sp
.ne 2
.na
\fB\fBPAM_USER_UNKNOWN\fR\fR
.ad
.RS 25n
User not known to underlying authentication module.
.RE

.sp
.ne 2
.na
\fB\fBPAM_IGNORE\fR\fR
.ad
.RS 25n
Ignore underlying authentication module regardless of whether the control flag
is \fIrequired\fR, \fIoptional\fR, or \fIsufficient\fR.
.RE

.SH ATTRIBUTES
See \fBattributes\fR(7) for description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	 Stable
_
MT-Level	MT-Safe with exceptions
.TE

.SH SEE ALSO
.BR libpam (3LIB),
.BR pam (3PAM),
.BR pam_authenticate (3PAM),
.BR pam_get_item (3PAM),
.BR pam_set_data (3PAM),
.BR pam_set_item (3PAM),
.BR pam_setcred (3PAM),
.BR pam_start (3PAM),
.BR pam.conf (5),
.BR attributes (7)
.SH NOTES
Modules should not retry the authentication in the event of a failure.
Applications handle authentication retries and maintain the retry count. To
limit the number of retries, the module can return a \fBPAM_MAXTRIES\fR error.
.sp
.LP
The interfaces in \fBlibpam\fR(3LIB) are MT-Safe only if each thread within the
multithreaded application uses its own \fBPAM\fR handle.
.sp
.LP
If the \fBPAM_REPOSITORY\fR \fIitem_type\fR is set and a service module does
not recognize the type, the service module does not process any information,
and returns \fBPAM_IGNORE\fR. If the \fBPAM_REPOSITORY\fR \fIitem_type\fR is
not set, a service module performs its default action.
